package com.sugon.handler;

import cn.afterturn.easypoi.handler.inter.IExcelDictHandler;

/**
 * @Author YuXD
 * @Version 1.0
 * @since 2022/6/11
 */
public class EasyPoiExcelDictHandlerImpl implements IExcelDictHandler {

    @Override
    public String toName(String dict, Object obj, String name, Object value) {
        if ("factoryType".equals(dict)) {
            // {0: '设备供应商', 1: '备件供应商', 2: '模具备件供应商'},
            String valueStr = value.toString();
            switch (valueStr) {
                case "0":
                    name = "设备供应商";
                    break;
                case "1":
                    name = "备件供应商";
                    break;
                case "2":
                    name = "模具备件供应商";
                    break;
                default:
                    name = "未知类型";
                    break;
            }
            return name;
        }
        return null;
    }

    @Override
    public String toValue(String dict, Object obj, String name, Object value) {
        return null;
    }
}
